package main

import "fmt"

type Man struct {
	name string
	sex  string
}

func (man *Man) Eat() {
	fmt.Println("Man.Eat()")
}

type SuperMan struct {
	Man   // SuperMan继承了Man类的方法
	level int
}

// 重新定义父类的方法Eat()
func (superMan *SuperMan) Eat() {
	fmt.Println("SuperMan.Eat()")
}

// 子类的新方法
func (superMan *SuperMan) Fly() {
	fmt.Printf("SuperMan.Fly()")
}

func main() {
	man := Man{"张三", "男"}
	man.Eat()

	superMan := SuperMan{Man{"李四", "男"}, 11}
	superMan.Eat()
	superMan.Fly()

	var s SuperMan
	s.name = "li4"
	s.sex = "male"
	s.level = 88
}
